#include <iostream>
#include<string>
#include <cstdio>
#include <algorithm>
using namespace std;

const int N = 5000010;
int arr[N];
int main()
{
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &arr[i]);
    }
    sort(arr, arr + n);
    cout << arr[k] << endl;
    return 0;
}